public class Person {
    private int age;
    private String sex;
    private String name;



    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        if (age<1 || age > 120){
            throw new AgeNotInRangeException("年龄不在范围内："+age);
        }
        this.age = age;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        if(sex.equals("男") || sex.equals("女")){
            this.sex = sex;
            return;
        }
        throw new SexIllgealException("性别不合法："+sex);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
